3.7.96 \(\int (a+i a \tan (e+f x))^3 (A+B \tan (e+f x)) \, dx\) [696]

Optimal. Leaf size=110 \[ 4 a^3 (A-i B) x-\frac {4 a^3 (i A+B) \log (\cos (e+f x))}{f}-\frac {2 a^3 (A-i B) \tan (e+f x)}{f}+\frac {a (i A+B) (a+i a \tan (e+f x))^2}{2 f}+\frac {B (a+i a \tan (e+f x))^3}{3 f} \]

[Out]

4*a^3*(A-I*B)*x-4*a^3*(I*A+B)*ln(cos(f*x+e))/f-2*a^3*(A-I*B)*tan(f*x+e)/f+1/2*a*(I*A+B)*(a+I*a*tan(f*x+e))^2/f
+1/3*B*(a+I*a*tan(f*x+e))^3/f

________________________________________________________________________________________

Rubi [A]
time = 0.07, antiderivative size = 110, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, integrand size = 26, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.154, Rules used = {3608, 3559, 3558, 3556} \begin {gather*} -\frac {2 a^3 (A-i B) \tan (e+f x)}{f}-\frac {4 a^3 (B+i A) \log (\cos (e+f x))}{f}+4 a^3 x (A-i B)+\frac {a (B+i A) (a+i a \tan (e+f x))^2}{2 f}+\frac {B (a+i a \tan (e+f x))^3}{3 f} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(a + I*a*Tan[e + f*x])^3*(A + B*Tan[e + f*x]),x]

[Out]

4*a^3*(A - I*B)*x - (4*a^3*(I*A + B)*Log[Cos[e + f*x]])/f - (2*a^3*(A - I*B)*Tan[e + f*x])/f + (a*(I*A + B)*(a
 + I*a*Tan[e + f*x])^2)/(2*f) + (B*(a + I*a*Tan[e + f*x])^3)/(3*f)

Rule 3556

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3558

Int[((a_) + (b_.)*tan[(c_.) + (d_.)*(x_)])^2, x_Symbol] :> Simp[(a^2 - b^2)*x, x] + (Dist[2*a*b, Int[Tan[c + d
*x], x], x] + Simp[b^2*(Tan[c + d*x]/d), x]) /; FreeQ[{a, b, c, d}, x]

Rule 3559

Int[((a_) + (b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[b*((a + b*Tan[c + d*x])^(n - 1)/(d*(n - 1))
), x] + Dist[2*a, Int[(a + b*Tan[c + d*x])^(n - 1), x], x] /; FreeQ[{a, b, c, d}, x] && EqQ[a^2 + b^2, 0] && G
tQ[n, 1]

Rule 3608

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[d*(
(a + b*Tan[e + f*x])^m/(f*m)), x] + Dist[(b*c + a*d)/b, Int[(a + b*Tan[e + f*x])^m, x], x] /; FreeQ[{a, b, c,
d, e, f, m}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 + b^2, 0] &&  !LtQ[m, 0]

Rubi steps

\begin {align*} \int (a+i a \tan (e+f x))^3 (A+B \tan (e+f x)) \, dx &=\frac {B (a+i a \tan (e+f x))^3}{3 f}-(-A+i B) \int (a+i a \tan (e+f x))^3 \, dx\\ &=\frac {a (i A+B) (a+i a \tan (e+f x))^2}{2 f}+\frac {B (a+i a \tan (e+f x))^3}{3 f}+(2 a (A-i B)) \int (a+i a \tan (e+f x))^2 \, dx\\ &=4 a^3 (A-i B) x-\frac {2 a^3 (A-i B) \tan (e+f x)}{f}+\frac {a (i A+B) (a+i a \tan (e+f x))^2}{2 f}+\frac {B (a+i a \tan (e+f x))^3}{3 f}+\left (4 a^3 (i A+B)\right ) \int \tan (e+f x) \, dx\\ &=4 a^3 (A-i B) x-\frac {4 a^3 (i A+B) \log (\cos (e+f x))}{f}-\frac {2 a^3 (A-i B) \tan (e+f x)}{f}+\frac {a (i A+B) (a+i a \tan (e+f x))^2}{2 f}+\frac {B (a+i a \tan (e+f x))^3}{3 f}\\ \end {align*}

________________________________________________________________________________________

Mathematica [B] Both result and optimal contain complex but leaf count is larger than twice the leaf count of optimal. \(331\) vs. \(2(110)=220\).
time = 2.03, size = 331, normalized size = 3.01 \begin {gather*} \frac {a^3 \sec (e) \sec ^3(e+f x) \left (6 A f x \cos (2 e+3 f x)-6 i B f x \cos (2 e+3 f x)+6 A f x \cos (4 e+3 f x)-6 i B f x \cos (4 e+3 f x)-3 i A \cos (2 e+3 f x) \log \left (\cos ^2(e+f x)\right )-3 B \cos (2 e+3 f x) \log \left (\cos ^2(e+f x)\right )-3 i A \cos (4 e+3 f x) \log \left (\cos ^2(e+f x)\right )-3 B \cos (4 e+3 f x) \log \left (\cos ^2(e+f x)\right )+3 \cos (f x) \left (-i A-3 B+6 A f x-6 i B f x+(-3 i A-3 B) \log \left (\cos ^2(e+f x)\right )\right )+3 \cos (2 e+f x) \left (-i A-3 B+6 A f x-6 i B f x+(-3 i A-3 B) \log \left (\cos ^2(e+f x)\right )\right )-18 A \sin (f x)+24 i B \sin (f x)+9 A \sin (2 e+f x)-15 i B \sin (2 e+f x)-9 A \sin (2 e+3 f x)+13 i B \sin (2 e+3 f x)\right )}{12 f} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(a + I*a*Tan[e + f*x])^3*(A + B*Tan[e + f*x]),x]

[Out]

(a^3*Sec[e]*Sec[e + f*x]^3*(6*A*f*x*Cos[2*e + 3*f*x] - (6*I)*B*f*x*Cos[2*e + 3*f*x] + 6*A*f*x*Cos[4*e + 3*f*x]
 - (6*I)*B*f*x*Cos[4*e + 3*f*x] - (3*I)*A*Cos[2*e + 3*f*x]*Log[Cos[e + f*x]^2] - 3*B*Cos[2*e + 3*f*x]*Log[Cos[
e + f*x]^2] - (3*I)*A*Cos[4*e + 3*f*x]*Log[Cos[e + f*x]^2] - 3*B*Cos[4*e + 3*f*x]*Log[Cos[e + f*x]^2] + 3*Cos[
f*x]*((-I)*A - 3*B + 6*A*f*x - (6*I)*B*f*x + ((-3*I)*A - 3*B)*Log[Cos[e + f*x]^2]) + 3*Cos[2*e + f*x]*((-I)*A
- 3*B + 6*A*f*x - (6*I)*B*f*x + ((-3*I)*A - 3*B)*Log[Cos[e + f*x]^2]) - 18*A*Sin[f*x] + (24*I)*B*Sin[f*x] + 9*
A*Sin[2*e + f*x] - (15*I)*B*Sin[2*e + f*x] - 9*A*Sin[2*e + 3*f*x] + (13*I)*B*Sin[2*e + 3*f*x]))/(12*f)

________________________________________________________________________________________

Maple [A]
time = 0.11, size = 100, normalized size = 0.91

method result size
derivativedivides \(\frac {a^{3} \left (-\frac {i B \left (\tan ^{3}\left (f x +e \right )\right )}{3}-\frac {i A \left (\tan ^{2}\left (f x +e \right )\right )}{2}+4 i B \tan \left (f x +e \right )-\frac {3 B \left (\tan ^{2}\left (f x +e \right )\right )}{2}-3 A \tan \left (f x +e \right )+\frac {\left (4 i A +4 B \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (-4 i B +4 A \right ) \arctan \left (\tan \left (f x +e \right )\right )\right )}{f}\) \(100\)
default \(\frac {a^{3} \left (-\frac {i B \left (\tan ^{3}\left (f x +e \right )\right )}{3}-\frac {i A \left (\tan ^{2}\left (f x +e \right )\right )}{2}+4 i B \tan \left (f x +e \right )-\frac {3 B \left (\tan ^{2}\left (f x +e \right )\right )}{2}-3 A \tan \left (f x +e \right )+\frac {\left (4 i A +4 B \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (-4 i B +4 A \right ) \arctan \left (\tan \left (f x +e \right )\right )\right )}{f}\) \(100\)
norman \(\left (-4 i B \,a^{3}+4 A \,a^{3}\right ) x -\frac {\left (i A \,a^{3}+3 B \,a^{3}\right ) \left (\tan ^{2}\left (f x +e \right )\right )}{2 f}-\frac {\left (-4 i B \,a^{3}+3 A \,a^{3}\right ) \tan \left (f x +e \right )}{f}-\frac {i B \,a^{3} \left (\tan ^{3}\left (f x +e \right )\right )}{3 f}+\frac {2 \left (i A \,a^{3}+B \,a^{3}\right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{f}\) \(117\)
risch \(\frac {8 i a^{3} B e}{f}-\frac {8 a^{3} A e}{f}-\frac {2 a^{3} \left (12 i A \,{\mathrm e}^{4 i \left (f x +e \right )}+24 B \,{\mathrm e}^{4 i \left (f x +e \right )}+21 i A \,{\mathrm e}^{2 i \left (f x +e \right )}+33 B \,{\mathrm e}^{2 i \left (f x +e \right )}+9 i A +13 B \right )}{3 f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )^{3}}-\frac {4 a^{3} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) B}{f}-\frac {4 i a^{3} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) A}{f}\) \(145\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+I*a*tan(f*x+e))^3*(A+B*tan(f*x+e)),x,method=_RETURNVERBOSE)

[Out]

1/f*a^3*(-1/3*I*B*tan(f*x+e)^3-1/2*I*A*tan(f*x+e)^2+4*I*B*tan(f*x+e)-3/2*B*tan(f*x+e)^2-3*A*tan(f*x+e)+1/2*(4*
I*A+4*B)*ln(1+tan(f*x+e)^2)+(-4*I*B+4*A)*arctan(tan(f*x+e)))

________________________________________________________________________________________

Maxima [A]
time = 0.50, size = 101, normalized size = 0.92 \begin {gather*} -\frac {2 i \, B a^{3} \tan \left (f x + e\right )^{3} + 3 \, {\left (i \, A + 3 \, B\right )} a^{3} \tan \left (f x + e\right )^{2} - 24 \, {\left (f x + e\right )} {\left (A - i \, B\right )} a^{3} + 12 \, {\left (-i \, A - B\right )} a^{3} \log \left (\tan \left (f x + e\right )^{2} + 1\right ) + 6 \, {\left (3 \, A - 4 i \, B\right )} a^{3} \tan \left (f x + e\right )}{6 \, f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))^3*(A+B*tan(f*x+e)),x, algorithm="maxima")

[Out]

-1/6*(2*I*B*a^3*tan(f*x + e)^3 + 3*(I*A + 3*B)*a^3*tan(f*x + e)^2 - 24*(f*x + e)*(A - I*B)*a^3 + 12*(-I*A - B)
*a^3*log(tan(f*x + e)^2 + 1) + 6*(3*A - 4*I*B)*a^3*tan(f*x + e))/f

________________________________________________________________________________________

Fricas [A]
time = 6.68, size = 184, normalized size = 1.67 \begin {gather*} -\frac {2 \, {\left (12 \, {\left (i \, A + 2 \, B\right )} a^{3} e^{\left (4 i \, f x + 4 i \, e\right )} + 3 \, {\left (7 i \, A + 11 \, B\right )} a^{3} e^{\left (2 i \, f x + 2 i \, e\right )} + {\left (9 i \, A + 13 \, B\right )} a^{3} + 6 \, {\left ({\left (i \, A + B\right )} a^{3} e^{\left (6 i \, f x + 6 i \, e\right )} + 3 \, {\left (i \, A + B\right )} a^{3} e^{\left (4 i \, f x + 4 i \, e\right )} + 3 \, {\left (i \, A + B\right )} a^{3} e^{\left (2 i \, f x + 2 i \, e\right )} + {\left (i \, A + B\right )} a^{3}\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right )\right )}}{3 \, {\left (f e^{\left (6 i \, f x + 6 i \, e\right )} + 3 \, f e^{\left (4 i \, f x + 4 i \, e\right )} + 3 \, f e^{\left (2 i \, f x + 2 i \, e\right )} + f\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))^3*(A+B*tan(f*x+e)),x, algorithm="fricas")

[Out]

-2/3*(12*(I*A + 2*B)*a^3*e^(4*I*f*x + 4*I*e) + 3*(7*I*A + 11*B)*a^3*e^(2*I*f*x + 2*I*e) + (9*I*A + 13*B)*a^3 +
 6*((I*A + B)*a^3*e^(6*I*f*x + 6*I*e) + 3*(I*A + B)*a^3*e^(4*I*f*x + 4*I*e) + 3*(I*A + B)*a^3*e^(2*I*f*x + 2*I
*e) + (I*A + B)*a^3)*log(e^(2*I*f*x + 2*I*e) + 1))/(f*e^(6*I*f*x + 6*I*e) + 3*f*e^(4*I*f*x + 4*I*e) + 3*f*e^(2
*I*f*x + 2*I*e) + f)

________________________________________________________________________________________

Sympy [A]
time = 0.38, size = 184, normalized size = 1.67 \begin {gather*} - \frac {4 i a^{3} \left (A - i B\right ) \log {\left (e^{2 i f x} + e^{- 2 i e} \right )}}{f} + \frac {- 18 i A a^{3} - 26 B a^{3} + \left (- 42 i A a^{3} e^{2 i e} - 66 B a^{3} e^{2 i e}\right ) e^{2 i f x} + \left (- 24 i A a^{3} e^{4 i e} - 48 B a^{3} e^{4 i e}\right ) e^{4 i f x}}{3 f e^{6 i e} e^{6 i f x} + 9 f e^{4 i e} e^{4 i f x} + 9 f e^{2 i e} e^{2 i f x} + 3 f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))**3*(A+B*tan(f*x+e)),x)

[Out]

-4*I*a**3*(A - I*B)*log(exp(2*I*f*x) + exp(-2*I*e))/f + (-18*I*A*a**3 - 26*B*a**3 + (-42*I*A*a**3*exp(2*I*e) -
 66*B*a**3*exp(2*I*e))*exp(2*I*f*x) + (-24*I*A*a**3*exp(4*I*e) - 48*B*a**3*exp(4*I*e))*exp(4*I*f*x))/(3*f*exp(
6*I*e)*exp(6*I*f*x) + 9*f*exp(4*I*e)*exp(4*I*f*x) + 9*f*exp(2*I*e)*exp(2*I*f*x) + 3*f)

________________________________________________________________________________________

Giac [B] Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 333 vs. \(2 (98) = 196\).
time = 0.65, size = 333, normalized size = 3.03 \begin {gather*} -\frac {2 \, {\left (6 i \, A a^{3} e^{\left (6 i \, f x + 6 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + 6 \, B a^{3} e^{\left (6 i \, f x + 6 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + 18 i \, A a^{3} e^{\left (4 i \, f x + 4 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + 18 \, B a^{3} e^{\left (4 i \, f x + 4 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + 18 i \, A a^{3} e^{\left (2 i \, f x + 2 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + 18 \, B a^{3} e^{\left (2 i \, f x + 2 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + 12 i \, A a^{3} e^{\left (4 i \, f x + 4 i \, e\right )} + 24 \, B a^{3} e^{\left (4 i \, f x + 4 i \, e\right )} + 21 i \, A a^{3} e^{\left (2 i \, f x + 2 i \, e\right )} + 33 \, B a^{3} e^{\left (2 i \, f x + 2 i \, e\right )} + 6 i \, A a^{3} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + 6 \, B a^{3} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + 9 i \, A a^{3} + 13 \, B a^{3}\right )}}{3 \, {\left (f e^{\left (6 i \, f x + 6 i \, e\right )} + 3 \, f e^{\left (4 i \, f x + 4 i \, e\right )} + 3 \, f e^{\left (2 i \, f x + 2 i \, e\right )} + f\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))^3*(A+B*tan(f*x+e)),x, algorithm="giac")

[Out]

-2/3*(6*I*A*a^3*e^(6*I*f*x + 6*I*e)*log(e^(2*I*f*x + 2*I*e) + 1) + 6*B*a^3*e^(6*I*f*x + 6*I*e)*log(e^(2*I*f*x
+ 2*I*e) + 1) + 18*I*A*a^3*e^(4*I*f*x + 4*I*e)*log(e^(2*I*f*x + 2*I*e) + 1) + 18*B*a^3*e^(4*I*f*x + 4*I*e)*log
(e^(2*I*f*x + 2*I*e) + 1) + 18*I*A*a^3*e^(2*I*f*x + 2*I*e)*log(e^(2*I*f*x + 2*I*e) + 1) + 18*B*a^3*e^(2*I*f*x
+ 2*I*e)*log(e^(2*I*f*x + 2*I*e) + 1) + 12*I*A*a^3*e^(4*I*f*x + 4*I*e) + 24*B*a^3*e^(4*I*f*x + 4*I*e) + 21*I*A
*a^3*e^(2*I*f*x + 2*I*e) + 33*B*a^3*e^(2*I*f*x + 2*I*e) + 6*I*A*a^3*log(e^(2*I*f*x + 2*I*e) + 1) + 6*B*a^3*log
(e^(2*I*f*x + 2*I*e) + 1) + 9*I*A*a^3 + 13*B*a^3)/(f*e^(6*I*f*x + 6*I*e) + 3*f*e^(4*I*f*x + 4*I*e) + 3*f*e^(2*
I*f*x + 2*I*e) + f)

________________________________________________________________________________________

Mupad [B]
time = 8.91, size = 125, normalized size = 1.14 \begin {gather*} -\frac {{\mathrm {tan}\left (e+f\,x\right )}^2\,\left (\frac {B\,a^3}{2}+\frac {a^3\,\left (2\,B+A\,1{}\mathrm {i}\right )}{2}\right )}{f}+\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )\,\left (4\,B\,a^3+A\,a^3\,4{}\mathrm {i}\right )}{f}+\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (B\,a^3\,1{}\mathrm {i}-a^3\,\left (2\,A-B\,1{}\mathrm {i}\right )+a^3\,\left (2\,B+A\,1{}\mathrm {i}\right )\,1{}\mathrm {i}\right )}{f}-\frac {B\,a^3\,{\mathrm {tan}\left (e+f\,x\right )}^3\,1{}\mathrm {i}}{3\,f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((A + B*tan(e + f*x))*(a + a*tan(e + f*x)*1i)^3,x)

[Out]

(log(tan(e + f*x) + 1i)*(A*a^3*4i + 4*B*a^3))/f - (tan(e + f*x)^2*((B*a^3)/2 + (a^3*(A*1i + 2*B))/2))/f + (tan
(e + f*x)*(B*a^3*1i - a^3*(2*A - B*1i) + a^3*(A*1i + 2*B)*1i))/f - (B*a^3*tan(e + f*x)^3*1i)/(3*f)

________________________________________________________________________________________